package org.epidroid.epidroid.chronos.engine.objects;

import java.util.ArrayList;

import org.epidroid.epidroid.chronos.engine.utils.ChronosUtils;

public class ChronosNode implements Printable {

	private String _id = null;
	private String _name = null;
	private ArrayList<ChronosNode> _nodes = null;

	public ChronosNode() {

	}

	public ChronosNode(String id, String name) {
		_id = id;
		_name = name;
	}

	public void setNodes(ArrayList<ChronosNode> nodes) {
		_nodes = nodes;
	}

	public void addNode(ChronosNode node) {
		_nodes.add(node);
	}

	public String getId() {
		return _id;
	}

	public String getName() {
		return _name;
	}

	public void setId(String id) {
		_id = id;
	}

	public void setName(String name) {
		_name = name;
	}

	public ArrayList<ChronosNode> getNodes() {
		return _nodes;
	}

	public void print(Integer indent) {
		ChronosUtils.printWithIndent(indent, "ID = " + _id);
		ChronosUtils.printWithIndent(indent, "NAME = " + _name);
		if (_nodes == null)
			return;
		for (ChronosNode node : _nodes) {
			if (null != node)
				node.print(indent + 4);
		}
	}

	public void print() {
		print(0);
	}
}
